import request from '@/utils/system/request'

// 获取角色列表数据
export function getData(params) {
    return request({
        url: '/role/page',
        method: 'get',
        params
    })
}

//批量删除角色
export function delRoles(data) {
    return request({
        url: '/role/delete',
        method: 'post',
        data
    })
}

//新增角色
export function addRole(data) {
    return request({
        url: '/role/add',
        method: 'post',
        data
    })
}

//编辑角色
export function editRole(data) {
    return request({
        url: '/role/edit',
        method: 'put',
        data
    })
}

//授权树形结构数据
export function getTreeData(roleId) {
    return request({
        url: '/role/menu/' + roleId,
        method: 'get',
        params: {}
    })
}

//授权
export function authData(data) {
    return request({
        url: '/role/menu/authorization',
        method: 'post',
        data
    });
}

//查询所有可用角色
export function findAllRole() {
    return request({
        url: "/role/all",
        method: "get",
        params: {}
    })
}

//取消授权
export function cancelUser(data) {
    return request({
        url: "/userRole/cancel",
        method: 'post',
        data
    });
}

//新增授权
export function saveUserRole(data) {
    return request({
        url: "/userRole/save",
        method: 'post',
        data
    })
}
